package org.JWCB.system.controller.user;


import jakarta.validation.constraints.NotNull;
import org.JWCB.common.core.controller.BaseController;
import org.JWCB.system.domain.user.dto.UserQueryDto;
import org.JWCB.common.core.domain.vo.R;
import org.JWCB.common.core.domain.vo.TableDataInfo;
import org.JWCB.system.service.user.impl.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RequestMapping("user")
@RestController
public class UserController extends BaseController {
    @Autowired
    private  UserService userService;


    @GetMapping("/list")
    public TableDataInfo list(@Validated  UserQueryDto userQueryDto) {
        return getTableList(userService.list(userQueryDto));
    }

    @PutMapping("/blacklist")
    public R<Void> blacklist(@NotNull(message = "userId不为空") Long userId) {
        return toR(userService.blacklist(userId));
    }

    @PutMapping("/liftBan")
    public R<Void> liftBan(@NotNull(message = "userId不为空") Long userId) {
        return toR(userService.liftBan(userId));
    }


}
